<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : ProjectsForAssignTask.xsl
    Created on : July 7, 2012, 10:23 AM
    Author     : ThanhTai
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <table name="projectsTable">
            <xsl:attribute name="id">
                <xsl:text>tableA</xsl:text>
            </xsl:attribute>
            <xsl:attribute name="border">
                <xsl:text>1</xsl:text>
            </xsl:attribute>
            <tbody>
                <tr>
                    <th>No.</th>
                    <th>ProjectName</th>
                    <th>ProjectManager</th>
                    <th>Description</th>
                    <th>Minestone</th>
                    <th>StartDay</th>
                    <th>EndDay</th>
                    <th>Status</th>
                </tr>
                <xsl:apply-templates select="projects"/>
            </tbody>
        </table>
    </xsl:template>

    <xsl:template match="projects">
        <xsl:apply-templates select="project"></xsl:apply-templates>
    </xsl:template>

    <xsl:template match="project">
        <form>
            <xsl:attribute name="id">
                <xsl:text>projectForm</xsl:text>
            </xsl:attribute>
            <tr>
                <td>
                    <xsl:number level="single" count="project"/>
                </td>
                <td>
                    <a>
                        <xsl:attribute name="href">
                            <xsl:text>pmAssignTask.jsp?action=getProjectForAssignTask&amp;ProjectID=</xsl:text>
                            <xsl:value-of select="projectID"/>&amp;ProjectName=
                            <xsl:value-of select="projectName"/>
                        </xsl:attribute>
                        <xsl:value-of select="projectName"/>
                    </a>
                </td>
                <td>
                    <xsl:value-of select="projectManager"/>
                </td>
                <td>
                    <xsl:value-of select="description"/>
                </td>
                <td>
                    <xsl:value-of select="numOfMinestone"/>
                </td>
                <td>
                    <xsl:apply-templates select="startDay"/>
                </td>
                <td>
                    <xsl:apply-templates select="endDay"/>
                </td>
                <td>
                    <xsl:value-of select="status"/>
                </td>
            </tr>
        </form>
    </xsl:template>
    <xsl:template match="startDay">
        <xsl:value-of select="year"/>-
        <xsl:value-of select="month"/>-
        <xsl:value-of select="day"/>
    </xsl:template>
    <xsl:template match="endDay">
        <xsl:value-of select="year"/>-
        <xsl:value-of select="month"/>-
        <xsl:value-of select="day"/>
    </xsl:template>

</xsl:stylesheet>
